/*
 * NetHelper.h
 *
 *  Created on: 2009-3-18
 *      Author: P. Weiwen
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>

using namespace std;

#ifndef NETHELPER_H_
#define NETHELPER_H_

struct nat_rule{
	char * in_if;
	char * ou_if;
	char * src_ip;
	char * des_ip;
	char * chain;		//DNAT chain:PREROUTING, OUTPUT
	short  s_port;
	short  d_port;
	short redirect;
	nat_rule(){
		in_if = ou_if = 0;
		src_ip = des_ip =0;
		chain	= "PREROUTING";
		s_port = d_port = redirect =0;
	}
};


class NAtHelper {

#define MAX_CMD		100
private:
	static NAtHelper * m_instance;
public:
	NAtHelper();

	static NAtHelper & getInstance();

	int 	AddDNat(nat_rule rule);
	int 	DelDNAT(nat_rule rule);
	int		AddSNAT(nat_rule rule);
	int		DelSNAT(nat_rule rule);
	virtual ~NAtHelper();
};

#endif /* NETHELPER_H_ */
